#! /usr/bin/python
# -*- coding: cp1250 -*-

import string

def sas_readall_macro_string(infiles_l):
    """ generate strings for readall macro """
    cnt_n = 1
    for infile_s in infiles_l:
        print   '%Readall(_'+\
                string.zfill(cnt_n,3)+\
                ','+\
                string.split(infile_s,'\\')[-1]+\
                ');',
        if str(cnt_n)[-1] in ('0','5'):
            print '\n',
        cnt_n += 1
    print '\n'
    for x in range(cnt_n)[1:]:
        print '_'+\
              string.zfill(x,3)+\
              ' (IN=in'+string.zfill(x,3)+\
              ')',
        if str(x)[-1] in ('0','5'):
            print '\n',
    print '\n'
    for x in range(cnt_n)[1:]:
        print 'ELSE IF '+\
              'in'+string.zfill(x,3)+\
              '  THEN  InFile = \''+\
              string.zfill(x,3)+\
              '\';',
        if str(x)[-1] in ('0','5'):
            print '\n',

if __name__ == "__main__":
    sas_readall_macro_string(['a.txt','b.txt'])
